ARG BASE_IMAGE=mcr.microsoft.com/dotnet/sdk:5.0
FROM ${BASE_IMAGE}
RUN . /etc/os-release && \
    if [ "$ID" = "debian" ]; then \
        case "$VERSION_ID" in \
            "10"|"9"|"8") \
                sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list; \
                sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list; \
                ;; \
        esac; \
    fi

RUN apt-get update -y && apt-get install -y git dos2unix && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
RUN dotnet tool install --global dotnet-ef || echo "dotnet-ef install failed, but continue."
ENV PATH="/root/.dotnet/tools:${PATH}"
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
ARG BASE_IMAGE=mcr.microsoft.com/dotnet/sdk:5.0
ENV BASE_IMAGE=${BASE_IMAGE}
RUN mkdir -p /build_time \
    && echo "base image ${BASE_IMAGE} build time: $(date '+%Y-%m-%d %H:%M:%S')" > /build_time/sdk.txt
ONBUILD RUN cat /build_time/sdk.txt
CMD ["/bin/sh", "-c", "for f in /build_time/*.txt; do cat \"$f\"; done"]